package servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Set;

/**
 * Created by kevin on 2020/4/7.
 */
public class FServlet extends HttpServlet {
    @Override
    public void init() throws ServletException {
        System.out.println("----hhh----");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //得到真实路径-盘符路径
        String path = this.getServletContext().getRealPath("");
        //得到资源流
        InputStream input = this.getServletContext().getResourceAsStream("");
        //获取当前路径下所有资源的路径
        Set<String> resourcePaths = this.getServletContext().getResourcePaths("/WEB-INF");
        System.out.println(resourcePaths);
        System.out.println("contextpath"+request.getContextPath());
    }

}
